package com.weaver.seconddev.api.tongli;

import com.weaver.verupgrade.conn.RecordSet;
import java.util.*;
import com.weaver.common.authority.annotation.WeaPermission;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.weaver.common.i18n.tool.util.I18nContextUtil;
import com.weaver.verupgrade.conn.CONN_TYPE;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.weaver.verupgrade.general.Util;
import com.alibaba.fastjson.JSON;

/**
 * @author chenkang.xu@weaver.cn
 * @create 2025-08-18 下午3:04
 * @Description
 */

// E10二开接口规范，接口地址需要以 /api/secondev开始，接口如需改造成无需权限认证接口，地址需修改为/papi/secondev开始
@RestController
@RequestMapping("api/secondev/rongli/TriggerSubWfAction")
public class TriggerSubWfAction {

    public static final org.slf4j.Logger logger_c1e8429 = LoggerFactory.getLogger(TriggerSubWfAction.class);



    @GetMapping("/getSrc")
    @ResponseBody
    @WeaPermission(publicPermission = true)
    public String getSrc(HttpServletRequest request, HttpServletResponse response) {
        String billid = Util.null2String(request.getParameter("billid"));
        Map<String, Object> apidatas = new HashMap<String, Object>();
        RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
        String poolname_zw = CONN_TYPE.workflow.getType();
        // TODO E10执行sql方法第二参数必须指定源，默认使用流程源，单体客户无需修改，微服务/组合客户需根据查询表所属服务切换源，或使用外部数据源
        rs.executeQuery("SELECT * FROM e10_common.uf_tasktree WHERE uf_tasktree.id = ? AND uf_tasktree.delete_type = 0 AND uf_tasktree.tenant_key = 'tl2k2r96ty'", poolname_zw, billid);
        if (rs.next()) {
            String lclj = Util.null2String(rs.getString("lclj"));
            String zdjd = Util.null2String(rs.getString("zdjd"));
            String src = Util.null2String(rs.getString("ljmbdzzd")).replace("$lclj$", lclj).replace("$zdjd$", zdjd);
            apidatas.put("src", src);
            apidatas.put("lclj", lclj);
            apidatas.put("zdjd", zdjd);
        }
        return JSON.toJSONString(apidatas);
    }

}
